<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.ahp.bean.*" %>
<%@ include file="../include/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
Module mod = (Module)request.getAttribute("module");
%>
<script type="text/javascript" src="<%=path %>/js/jquery-1.3.2.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=path%>/style/style_manage.css" type="text/css"></link>
<title>添加新模板</title>
<style type="text/css">
.added{border: 1px solid gray; margin: 1em 1em; padding: 5px 8px;}
.delSpan{cursor: pointer;}
div{line-height: 150%;}
</style>
<script type="text/javascript">
	function addfirstFactor(){
		var modID = $("#modId").val();
		var name = $("#name").val();
		var information = $("#information").val();
		$.post("<%=path%>/factor/addFirstFactor.action",{
			"factor.level":"1",
			"factor.pid":"0",
			"factor.level":"1",
			"factor.module.modId":modID,
			"factor.name":name,
			"factor.information":information,
			d:new Date().getMilliseconds()
		},function(data){
			if(data == "suc"){
				$("#newFactor").append("<span class='added'>"+name+"</span>&nbsp;");
			}
		
		});
}

 next = function (){
 	window.location.href="<%=path%>/factor/findFirstFactor.action?id="+<%=mod.getModId()%>;
 }

</script>
</head>
<body>
<div id="management">

<div style="font-size: 20px;font-weight: bold;">添加模板<%=mod.getName() %>一级因子</div>
	<input type="hidden" name="factor.level" value="1"/>
	<input type="hidden" name="factor.pid" value="0"/>
	<input type="hidden" name="factor.level" value="1"/>
	<input type="hidden" id="modId" value="<%=mod.getModId() %>"/>
	<div id="newFactor"></div>
	<br/>
		<table class="table">
			<tr>
				<td align="right" width="45%">名称：</td>
				<td><input type="text" name="factor.name" id="name"/></td>
			</tr>
			<tr>
				<td align="right" width="45%">说明：</td>
				<td><textarea rows="3" cols="18" name="factor.information" id="information"></textarea></td>
			</tr>
			<tr>
				<td colspan="2" align="center"><input type="button" value="添加" onclick="addfirstFactor();"/>
				<input type="button" value="下一步" onclick="next();"/>
				</td>
			</tr>
		</table>
</div>
</body>
</html>